package org.jeecg.modules.inspect.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.inspect.entity.InsClassesCheckInterval;
import org.jeecg.modules.inspect.mapper.InsClassesCheckIntervalMapper;
import org.jeecg.modules.inspect.mapper.InsClassesCheckIntervalTimeMapper;
import org.jeecg.modules.inspect.mapper.InsClassesCheckIntervalUserMapper;
import org.jeecg.modules.inspect.service.IInsClassesCheckIntervalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;

/**
 * @Description: ins_classes_check_interval
 * @Author: jeecg-boot
 * @Date:   2024-04-11
 * @Version: V1.0
 */
@Service
public class InsClassesCheckIntervalServiceImpl extends ServiceImpl<InsClassesCheckIntervalMapper, InsClassesCheckInterval> implements IInsClassesCheckIntervalService {

	@Autowired
	private InsClassesCheckIntervalMapper insClassesCheckIntervalMapper;
	@Autowired
	private InsClassesCheckIntervalUserMapper insClassesCheckIntervalUserMapper;
	@Autowired
	private InsClassesCheckIntervalTimeMapper insClassesCheckIntervalTimeMapper;
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delMain(String id) {
		insClassesCheckIntervalUserMapper.deleteByMainId(id);
		insClassesCheckIntervalTimeMapper.deleteByMainId(id);
		insClassesCheckIntervalMapper.deleteById(id);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			insClassesCheckIntervalUserMapper.deleteByMainId(id.toString());
			insClassesCheckIntervalTimeMapper.deleteByMainId(id.toString());
			insClassesCheckIntervalMapper.deleteById(id);
		}
	}
	
}
